FROM alpine:3.8

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.tuna.tsinghua.edu.cn/g' /etc/apk/repositories

ARG DOCKER_IMAGE_TAG
ENV FB_VERSION=$DOCKER_IMAGE_TAG

# wget https://download.elastic.co/beats/filebeat/filebeat-1.0.0-x86_64.tar.gz
# wget https://download.elastic.co/beats/filebeat/filebeat-1.1.0-x86_64.tar.gz
# wget https://download.elastic.co/beats/filebeat/filebeat-1.2.0-x86_64.tar.gz
# wget https://download.elastic.co/beats/filebeat/filebeat-1.3.0-x86_64.tar.gz

# wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-5.0.0-linux-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.0.0-linux-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.0.0-linux-x86_64.tar.gz
# wget https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-8.0.0-linux-x86_64.tar.gz

# https://wiki.alpinelinux.org/wiki/Running_glibc_programs
# https://pkgs.alpinelinux.org/packages?name=gcompat&branch=v3.8&repo=&arch=&maintainer=
RUN set -eux; \
	apk add --no-cache \
		gcompat \
	;

ADD filebeat-$FB_VERSION-x86_64 /usr/share/filebeat

WORKDIR /usr/share/filebeat

CMD ["/usr/share/filebeat/filebeat"]
